#include <iostream>
#include <string>
#include <boost/exception/all.hpp>
#include <boost/throw_exception.hpp>
typedef boost::error_info<struct tag_my_info, std::wstring> my_info;
struct my_error : virtual boost::exception, virtual std::exception {};
std::wstring convert(const std::string& str)
{
	return std::wstring(str.begin(), str.end());
}
int main(int argc, char *argv[])
{
	#ifdef _DEBUG
	std::cout << "debug" << std::endl;
	#endif
	#ifdef NDEBUG
	std::cout << "release" << std::endl;
	#endif
	try {
		throw my_error() << my_info(L"test");
	} catch(const my_error&e) {
		const std::wstring* str = boost::get_error_info<my_info>(e);
		std::wcout << L"my_error=" << *str << std::endl;
	} catch(const std::exception &e){
		std::wcout << "std::exception=" << convert(e.what()) << std::endl;
	}
	try {
		throw std::runtime_error("runtime_error");
	} catch(const my_error&e) {
		const std::wstring* str = boost::get_error_info<my_info>(e);
		std::wcout << L"my_error=" << *str << std::endl;
	} catch(const std::exception &e){
		std::wcout << "std::exception=" << convert(e.what()) << std::endl;
	}
	try {
		throw std::logic_error("logic_error");
	} catch(const my_error&e) {
		const std::wstring* str = boost::get_error_info<my_info>(e);
		std::wcout << L"my_error=" << *str << std::endl;
	} catch(const std::exception &e){
		std::wcout << "std::exception=" << convert(e.what()) << std::endl;
	}
}
